Introduce Schematics Tree methods for readText and readJSON#23006
Merged
Conversation
3a3af1f to
fdfc3cc
Compare
fdfc3cc to
691133f
Compare
dgp1130
requested changes
Apr 22, 2022
Collaborator
dgp1130
left a comment
There was a problem hiding this comment.
Thanks for splitting up the commits and taking the time to update existing usages. The readJSON() improvements seem particularly nice.
fa10db3 to
87cbc51
Compare
…ly from a Tree The schematics `Tree` now contains an additional `readText` method that supports directly reading the content of a file as UTF-8 text. This avoids the need to manually decode a Buffer within a schematic when text content is needed. If a file path does not exist, an exception will be thrown. While this differs from the semantics of `read`, it helps reduce the amount of code needed for common schematic use cases.
…ly from a Tree The schematics `Tree` now contains an additional `readJSON` method that supports directly reading and parsing the content of a file as UTF-8 JSON with comment support. This avoids the need to manually decode a Buffer, parse and handle JSON comments within a schematic when JSON content is needed. If a file path does not exist, an exception will be thrown. While this differs from the semantics of `read`, it helps reduce the amount of code needed for common schematic use cases. JSON parse errors will also result in an exception being thrown with a message detailing the error.
87cbc51 to
c7f1642
Compare
… and `readJSON` functionality Code related to decoding buffers into strings and parsing content into JSON can now be removed by using the support provided directly from the Tree instance for the executing schematic.
c7f1642 to
b3c4229
Compare
dgp1130
approved these changes
Apr 26, 2022
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The schematics
Treenow contains an additionalreadTextmethod that supports directlyreading the content of a file as UTF-8 text. This avoids the need to manually decode a Buffer
within a schematic when text content is needed. If a file path does not exist, an exception
will be thrown. While this differs from the semantics of
read, it helps reduce the amountof code needed for common schematic use cases.
The schematics
Treenow contains an additionalreadJSONmethod that supports directlyreading and parsing the content of a file as UTF-8 JSON with comment support. This avoids the need to manually
decode a Buffer, parse and handle JSON comments within a schematic when JSON content is needed.
If a file path does not exist, an exception will be thrown. While this differs from the semantics of
read,it helps reduce the amount of code needed for common schematic use cases. JSON parse errors will also result
in an exception being thrown with a message detailing the error.